package com.HospitalOutpatient.dao;

import com.HospitalOutpatient.entity.Outpatient;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface OutpatientDao {

    @Select("select * from outpatient where outpatientId = #{outpatientId}")
    Outpatient getOutpatientById(String outpatientId);

    @Select("select * from outpatient ")
    List<Outpatient> getAllOutpatient();

    @Select("select * from outpatient where outpatientName = #{outpatientName}")
    Outpatient getOutpatientByName(String outpatientName);

    @Select("select  * from outpatient where departmentId = #{departmentId}")
    List<Outpatient> selectOutpatientByDepartmentId(String DepartmentId);
    @Insert("insert into outpatient values(null,#{outpatientName},#{departmentId})")
    int insertOutpatient(Outpatient outpatient);
    @Update("update outpatient set outpatientName = #{outpatientName},departmentId = #{departmentId} where outpatientId = #{outpatientId}")
    int updateOutpatient(Outpatient outpatient);


}
